package com.naiterui.ehp.bs.recommend.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.naiterui.common.repository.page.PageParamVO;
import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.bo.recommend.MedicationRecomBO;
import com.naiterui.ehp.bp.bo.recommend.MedicationRecomDetailBO;
import com.naiterui.ehp.bp.bo.recommend.MedicationRecomPaBO;
import com.naiterui.ehp.bp.utils.beans.BeanUtil;
import com.naiterui.ehp.bs.recommend.bean.MedicationRecomDetail;
import com.naiterui.ehp.bs.recommend.repository.mysql.IMedicationRecomDetailRepository;
import com.naiterui.ehp.bs.recommend.service.IDrPtRecomService;
import com.naiterui.ehp.bs.recommend.service.IRecomService;

/**
 * @author guoyongxiang
 * @date 2019-06-28 15:04
 * @since 1.0.0
 */
@Service
public class DrPtRecomServiceImpl implements IDrPtRecomService {

    @Autowired
    private IRecomService recomService;
    @Autowired
    private IMedicationRecomDetailRepository medicationRecomDetailRepository;


    @Override
    public List<MedicationRecomDetailBO> getRecomDetails(Set<Long> recommendIds) {
        List<MedicationRecomDetail> details = medicationRecomDetailRepository.findByRecommendIdIn(recommendIds);
        List<MedicationRecomDetailBO> detailBOList = new ArrayList<>();
        BeanUtil.copyList(details, detailBOList, MedicationRecomDetailBO.class);
        return detailBOList;
    }

    @Override
    public List<MedicationRecomBO> getSpecifydayRecom(List<Integer> recomStatus, Date start, Date end) {
        return this.recomService.getSpecifydayRecom(recomStatus, start, end);
    }

    @Override
    public PageVO<MedicationRecomPaBO> getRecomDrugList(Long patientId, Long doctorId, Long consultId, int page, int num) {
        return this.recomService.getRecomDrugList(patientId, doctorId, consultId, page, num);
    }

    @Override
    public PageVO<MedicationRecomPaBO> getPatientRecomList(Long patientId, PageParamVO paramVO, Integer status, Integer type) {
        return this.recomService.getPatientRecomList(patientId, paramVO, status, type);
    }

    @Override
    public Map<Long, Integer> getRecomStatusMap(Set<Long> recomIds) {
        return this.recomService.getRecomStatusMap(recomIds);
    }
}
